import logging,yagmail,HTMLTestRunner_PY3

class Tools():
    def Report(self):
        report = HTMLTestRunner_PY3.HTMLTestRunner(open('./report.html','wb'),
                                                   title='WebUI自动化测试报告',
                                                   description='包含一条测试用例')
        return report

    def Log(self):
        log = logging.basicConfig(level=logging.DEBUG,
                                  format='%(levelname)s-%(filename)s-%(message)s-%(asctime)s-%(lineno)d',
                                  filemode='a+',
                                  filename='./log.txt')
        return log

    def send_email(self):
        mail = yagmail.SMTP(user='3047217905@qq.com',password='wsmqyonwzaxqdcgj',port='465',host='smtp.qq.com')
        mail.send(to='3047217905@qq.com',subject='今日份自动化测试请查收！',contents=['report.html','log.txt'])
        mail.close()
